home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / NameRegistry.a < prev    next >
Encoding:
Text File  |  1998-02-12  |  15.2 KB  |  562 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        NameRegistry.a
  3. ;
  4. ;    Contains:    NameRegistry Interfaces
  5. ;
  6. ;    Version:    Technology:    MacOS
  7. ;                Release:    Universal Interfaces 3.1
  8. ;
  9. ;    Copyright:    © 1993-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__NAMEREGISTRY__') = 'UNDEFINED' THEN
  19. __NAMEREGISTRY__ SET 1
  20.  
  21.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  22.     include 'MacTypes.a'
  23.     ENDIF
  24.  
  25. ; *******************************************************************************
  26. ; * 
  27. ; * Foundation Types
  28. ; *
  29.  
  30. ;  Value of a property 
  31. ; typedef void *                        RegPropertyValue
  32.  
  33. ;  Length of property value 
  34. ; typedef UInt32                         RegPropertyValueSize
  35.  
  36. ; *******************************************************************************
  37. ; * 
  38. ; * RegEntryID    :    The Global x-Namespace Entry Identifier
  39. ; *
  40.  
  41. RegEntryID                RECORD 0
  42. contents                 ds.l    4                ; offset: $0 (0)
  43. sizeof                     EQU *                    ; size:   $10 (16)
  44.                         ENDR
  45. ; typedef struct RegEntryID *            RegEntryIDPtr
  46.  
  47. ; *******************************************************************************
  48. ; *
  49. ; * Root Entry Name Definitions    (Applies to all Names in the RootNameSpace)
  50. ; *
  51. ; *    • Names are a colon-separated list of name components.  Name components
  52. ; *      may not themselves contain colons.  
  53. ; *    • Names are presented as null-terminated ASCII character strings.
  54. ; *    • Names follow similar parsing rules to Apple file system absolute
  55. ; *      and relative paths.  However the '::' parent directory syntax is
  56. ; *      not currently supported.
  57.  
  58. ;  Max length of Entry Name 
  59.  
  60. kRegCStrMaxEntryNameLength        EQU        47
  61. ;  Entry Names are single byte ASCII 
  62. ; typedef char                             RegCStrEntryName
  63.  
  64. ; typedef char *                        RegCStrEntryNamePtr
  65.  
  66. ;  length of RegCStrEntryNameBuf =  kRegCStrMaxEntryNameLength+1
  67. RegCStrEntryNameBuf        RECORD 0
  68. elements                 ds.b    48
  69. sizeof                     EQU *                    ; size:   $30 (48)
  70.                         ENDR
  71.  
  72.  
  73. ; typedef char                             RegCStrPathName
  74.  
  75. ; typedef UInt32                         RegPathNameSize
  76.  
  77.  
  78. kRegPathNameSeparator            EQU        58                    ; 0x3A 
  79. kRegEntryNameTerminator            EQU        $00                    ; '\0' 
  80. kRegPathNameTerminator            EQU        $00                    ; '\0' 
  81. ; *******************************************************************************
  82. ; *
  83. ; * Property Name and ID Definitions
  84. ; *    (Applies to all Properties Regardless of NameSpace)
  85.  
  86.  
  87. kRegMaximumPropertyNameLength    EQU        31                    ; Max length of Property Name 
  88. kRegPropertyNameTerminator        EQU        $00                    ; '\0' 
  89. RegPropertyNameBuf        RECORD 0
  90. elements                 ds.b    32
  91. sizeof                     EQU *                    ; size:   $20 (32)
  92.                         ENDR
  93.  
  94.  
  95. ; typedef char                             RegPropertyName
  96.  
  97. ; typedef char *                        RegPropertyNamePtr
  98.  
  99. ; *******************************************************************************
  100. ; *
  101. ; * Iteration Operations
  102. ; *
  103. ; *    These specify direction when traversing the name relationships
  104.  
  105. ; typedef UInt32                         RegIterationOp
  106.  
  107. ; typedef RegIterationOp                 RegEntryIterationOp
  108.  
  109.  
  110.                                                             ; Absolute locations
  111. kRegIterRoot                    EQU        $00000002            ; "Upward" Relationships    
  112. kRegIterParents                    EQU        $00000003            ; include all  parent(s) of entry 
  113.                                                             ; "Downward" Relationships
  114. kRegIterChildren                EQU        $00000004            ; include all children 
  115. kRegIterSubTrees                EQU        $00000005            ; include all sub trees of entry 
  116. kRegIterDescendants                EQU        $00000005            ; include all descendants of entry 
  117.                                                             ; "Horizontal" Relationships    
  118. kRegIterSibling                    EQU        $00000006            ; include all siblings 
  119.                                                             ; Keep doing the same thing
  120. kRegIterContinue                EQU        $00000001
  121. ; *******************************************************************************
  122. ; *
  123. ; * Name Entry and Property Modifiers
  124. ; *
  125. ; *
  126. ; *
  127. ; * Modifiers describe special characteristics of names
  128. ; * and properties.  Modifiers might be supported for
  129. ; * some names and not others.
  130. ; * 
  131. ; * Device Drivers should not rely on functionality
  132. ; * specified as a modifier.
  133.  
  134. ; typedef UInt32                         RegModifiers
  135.  
  136. ; typedef RegModifiers                     RegEntryModifiers
  137.  
  138. ; typedef RegModifiers                     RegPropertyModifiers
  139.  
  140.  
  141. kRegNoModifiers                    EQU        $00000000            ; no entry modifiers in place 
  142. kRegUniversalModifierMask        EQU        $0000FFFF            ; mods to all entries 
  143. kRegNameSpaceModifierMask        EQU        $00FF0000            ; mods to all entries within namespace 
  144. kRegModifierMask                EQU        $FF000000            ; mods to just this entry 
  145. ;  Universal Property Modifiers 
  146.  
  147. kRegPropertyValueIsSavedToNVRAM    EQU        $00000020            ; property is non-volatile (saved in NVRAM) 
  148. kRegPropertyValueIsSavedToDisk    EQU        $00000040            ; property is non-volatile (saved on disk) 
  149. ;  ///////////////////////
  150. ;//
  151. ;// The Registry API
  152. ;//
  153. ;/////////////////////// 
  154.  
  155. ;  ///////////////////////
  156. ;//
  157. ;// Entry Management
  158. ;//
  159. ;/////////////////////// 
  160.  
  161.  
  162. ; -------------------------------
  163. ; * EntryID handling
  164.  
  165. ; * Initialize an EntryID to a known invalid state
  166. ; *   note: invalid != uninitialized
  167.  
  168. ;
  169. ; extern OSStatus RegistryEntryIDInit(RegEntryID *id)
  170. ;
  171.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  172.         IMPORT_CFM_FUNCTION RegistryEntryIDInit
  173.     ENDIF
  174.  
  175. ; * Compare EntryID's for equality or if invalid
  176. ; *
  177. ; * If a NULL value is given for either id1 or id2, the other id 
  178. ; * is compared with an invalid ID.  If both are NULL, the id's 
  179. ; * are consided equal (result = true). 
  180.  
  181. ;
  182. ; extern Boolean RegistryEntryIDCompare(const RegEntryID *id1, const RegEntryID *id2)
  183. ;
  184.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  185.         IMPORT_CFM_FUNCTION RegistryEntryIDCompare
  186.     ENDIF
  187.  
  188. ; * Copy an EntryID
  189.  
  190. ;
  191. ; extern OSStatus RegistryEntryIDCopy(const RegEntryID *src, RegEntryID *dst)
  192. ;
  193.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  194.         IMPORT_CFM_FUNCTION RegistryEntryIDCopy
  195.     ENDIF
  196.  
  197. ; * Free an ID so it can be reused.
  198.  
  199. ;
  200. ; extern OSStatus RegistryEntryIDDispose(RegEntryID *id)
  201. ;
  202.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  203.         IMPORT_CFM_FUNCTION RegistryEntryIDDispose
  204.     ENDIF
  205.  
  206. ; -------------------------------
  207. ; * Adding and removing entries
  208. ; *
  209. ; * If (parentEntry) is NULL, the name is assumed
  210. ; * to be a rooted path. It is rooted to an anonymous, unnamed root.
  211.  
  212. ;
  213. ; extern OSStatus RegistryCStrEntryCreate(const RegEntryID *parentEntry, const RegCStrPathName *name, RegEntryID *newEntry)
  214. ;
  215.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  216.         IMPORT_CFM_FUNCTION RegistryCStrEntryCreate
  217.     ENDIF
  218.  
  219. ;
  220. ; extern OSStatus RegistryEntryDelete(const RegEntryID *id)
  221. ;
  222.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  223.         IMPORT_CFM_FUNCTION RegistryEntryDelete
  224.     ENDIF
  225.  
  226. ;
  227. ; extern OSStatus RegistryEntryCopy(RegEntryID *parentEntryID, RegEntryID *sourceDevice, RegEntryID *destDevice)
  228. ;
  229.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  230.         IMPORT_CFM_FUNCTION RegistryEntryCopy
  231.     ENDIF
  232.  
  233. ; ---------------------------
  234. ; * Traversing the namespace
  235. ; *
  236. ; * To support arbitrary namespace implementations in the future,
  237. ; * I have hidden the form that the place pointer takes.  The previous
  238. ; * interface exposed the place pointer by specifying it as a
  239. ; * RegEntryID.
  240. ; *
  241. ; * I have also removed any notion of returning the entries
  242. ; * in a particular order, because an implementation might
  243. ; * return the names in semi-random order.  Many name service
  244. ; * implementations will store the names in a hashed lookup
  245. ; * table.
  246. ; *
  247. ; * Writing code to traverse some set of names consists of
  248. ; * a call to begin the iteration, the iteration loop, and
  249. ; * a call to end the iteration.  The begin call initializes
  250. ; * the iteration cookie data structure.  The call to end the 
  251. ; * iteration should be called even in the case of error so 
  252. ; * that allocated data structures can be freed.
  253. ; *
  254. ; *    Create(...)
  255. ; *    do {
  256. ; *        Iterate(...);
  257. ; *    } while (!done);
  258. ; *    Dispose(...);
  259. ; *
  260. ; * This is the basic code structure for callers of the iteration
  261. ; * interface.
  262.  
  263.  
  264.  
  265. ;  
  266. ; * create/dispose the iterator structure
  267. ; *   defaults to root with relationship = kRegIterDescendants
  268.  
  269. ;
  270. ; extern OSStatus RegistryEntryIterateCreate(RegEntryIter *cookie)
  271. ;
  272.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  273.         IMPORT_CFM_FUNCTION RegistryEntryIterateCreate
  274.     ENDIF
  275.  
  276. ;
  277. ; extern OSStatus RegistryEntryIterateDispose(RegEntryIter *cookie)
  278. ;
  279.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  280.         IMPORT_CFM_FUNCTION RegistryEntryIterateDispose
  281.     ENDIF
  282.  
  283. ;  
  284. ; * set Entry Iterator to specified entry
  285.  
  286. ;
  287. ; extern OSStatus RegistryEntryIterateSet(RegEntryIter *cookie, const RegEntryID *startEntryID)
  288. ;
  289.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  290.         IMPORT_CFM_FUNCTION RegistryEntryIterateSet
  291.     ENDIF
  292.  
  293. ; * Return each value of the iteration
  294. ; *
  295. ; * return entries related to the current entry
  296. ; * with the specified relationship
  297.  
  298. ;
  299. ; extern OSStatus RegistryEntryIterate(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done)
  300. ;
  301.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  302.         IMPORT_CFM_FUNCTION RegistryEntryIterate
  303.     ENDIF
  304.  
  305. ; * return entries with the specified property
  306. ; *
  307. ; * A NULL RegPropertyValue pointer will return an
  308. ; * entry with the property containing any value.
  309.  
  310. ;
  311. ; extern OSStatus RegistryEntrySearch(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize)
  312. ;
  313.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  314.         IMPORT_CFM_FUNCTION RegistryEntrySearch
  315.     ENDIF
  316.  
  317. ; --------------------------------
  318. ; * Find a name in the namespace
  319. ; *
  320. ; * This is the fast lookup mechanism.
  321. ; * NOTE:  A reverse lookup mechanism
  322. ; *      has not been provided because
  323. ; *        some name services may not
  324. ; *        provide a fast, general reverse
  325. ; *        lookup.
  326.  
  327. ;
  328. ; extern OSStatus RegistryCStrEntryLookup(const RegEntryID *searchPointID, const RegCStrPathName *pathName, RegEntryID *foundEntry)
  329. ;
  330.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  331.         IMPORT_CFM_FUNCTION RegistryCStrEntryLookup
  332.     ENDIF
  333.  
  334. ; ---------------------------------------------
  335. ; * Convert an entry to a rooted name string
  336. ; *
  337. ; * A utility routine to turn an Entry ID
  338. ; * back into a name string.
  339.  
  340. ;
  341. ; extern OSStatus RegistryEntryToPathSize(const RegEntryID *entryID, RegPathNameSize *pathSize)
  342. ;
  343.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  344.         IMPORT_CFM_FUNCTION RegistryEntryToPathSize
  345.     ENDIF
  346.  
  347. ;
  348. ; extern OSStatus RegistryCStrEntryToPath(const RegEntryID *entryID, RegCStrPathName *pathName, RegPathNameSize pathSize)
  349. ;
  350.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  351.         IMPORT_CFM_FUNCTION RegistryCStrEntryToPath
  352.     ENDIF
  353.  
  354. ; * Parse a path name.
  355. ; *
  356. ; * Retrieve the last component of the path, and
  357. ; * return a spec for the parent.
  358.  
  359. ;
  360. ; extern OSStatus RegistryCStrEntryToName(const RegEntryID *entryID, RegEntryID *parentEntry, RegCStrEntryName *nameComponent, Boolean *done)
  361. ;
  362.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  363.         IMPORT_CFM_FUNCTION RegistryCStrEntryToName
  364.     ENDIF
  365.  
  366. ;  //////////////////////////////////////////////////////
  367. ;//
  368. ;// Property Management
  369. ;//
  370. ;////////////////////////////////////////////////////// 
  371.  
  372. ; -------------------------------
  373. ; * Adding and removing properties
  374.  
  375. ;
  376. ; extern OSStatus RegistryPropertyCreate(const RegEntryID *entryID, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize)
  377. ;
  378.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  379.         IMPORT_CFM_FUNCTION RegistryPropertyCreate
  380.     ENDIF
  381.  
  382. ;
  383. ; extern OSStatus RegistryPropertyDelete(const RegEntryID *entryID, const RegPropertyName *propertyName)
  384. ;
  385.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  386.         IMPORT_CFM_FUNCTION RegistryPropertyDelete
  387.     ENDIF
  388.  
  389. ;
  390. ; extern OSStatus RegistryPropertyRename(const RegEntryID *entry, const RegPropertyName *oldName, const RegPropertyName *newName)
  391. ;
  392.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  393.         IMPORT_CFM_FUNCTION RegistryPropertyRename
  394.     ENDIF
  395.  
  396. ; ---------------------------
  397. ; * Traversing the Properties of a name
  398. ; *
  399.  
  400.  
  401.  
  402. ;
  403. ; extern OSStatus RegistryPropertyIterateCreate(const RegEntryID *entry, RegPropertyIter *cookie)
  404. ;
  405.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  406.         IMPORT_CFM_FUNCTION RegistryPropertyIterateCreate
  407.     ENDIF
  408.  
  409. ;
  410. ; extern OSStatus RegistryPropertyIterateDispose(RegPropertyIter *cookie)
  411. ;
  412.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  413.         IMPORT_CFM_FUNCTION RegistryPropertyIterateDispose
  414.     ENDIF
  415.  
  416. ;
  417. ; extern OSStatus RegistryPropertyIterate(RegPropertyIter *cookie, RegPropertyName *foundProperty, Boolean *done)
  418. ;
  419.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  420.         IMPORT_CFM_FUNCTION RegistryPropertyIterate
  421.     ENDIF
  422.  
  423. ; * Get the value of the specified property for the specified entry.
  424. ; *
  425.  
  426. ;
  427. ; extern OSStatus RegistryPropertyGetSize(const RegEntryID *entryID, const RegPropertyName *propertyName, RegPropertyValueSize *propertySize)
  428. ;
  429.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  430.         IMPORT_CFM_FUNCTION RegistryPropertyGetSize
  431.     ENDIF
  432.  
  433. ; * (*propertySize) is the maximum size of the value returned in the buffer
  434. ; * pointed to by (propertyValue).  Upon return, (*propertySize) is the size of the
  435. ; * value returned.
  436.  
  437. ;
  438. ; extern OSStatus RegistryPropertyGet(const RegEntryID *entryID, const RegPropertyName *propertyName, void *propertyValue, RegPropertyValueSize *propertySize)
  439. ;
  440.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  441.         IMPORT_CFM_FUNCTION RegistryPropertyGet
  442.     ENDIF
  443.  
  444. ;
  445. ; extern OSStatus RegistryPropertySet(const RegEntryID *entryID, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize)
  446. ;
  447.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  448.         IMPORT_CFM_FUNCTION RegistryPropertySet
  449.     ENDIF
  450.  
  451. ;  //////////////////////////////////////////////////////
  452. ;//
  453. ;// Modifier Management
  454. ;//
  455. ;////////////////////////////////////////////////////// 
  456.  
  457. ; * Modifiers describe special characteristics of names
  458. ; * and properties.  Modifiers might be supported for
  459. ; * some names and not others.
  460. ; * 
  461. ; * Device Drivers should not rely on functionality
  462. ; * specified as a modifier.  These interfaces
  463. ; * are for use in writing Experts.
  464.  
  465. ; * Get and Set operators for entry modifiers
  466.  
  467. ;
  468. ; extern OSStatus RegistryEntryGetMod(const RegEntryID *entry, RegEntryModifiers *modifiers)
  469. ;
  470.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  471.         IMPORT_CFM_FUNCTION RegistryEntryGetMod
  472.     ENDIF
  473.  
  474. ;
  475. ; extern OSStatus RegistryEntrySetMod(const RegEntryID *entry, RegEntryModifiers modifiers)
  476. ;
  477.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  478.         IMPORT_CFM_FUNCTION RegistryEntrySetMod
  479.     ENDIF
  480.  
  481. ; * Get and Set operators for property modifiers
  482.  
  483. ;
  484. ; extern OSStatus RegistryPropertyGetMod(const RegEntryID *entry, const RegPropertyName *name, RegPropertyModifiers *modifiers)
  485. ;
  486.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  487.         IMPORT_CFM_FUNCTION RegistryPropertyGetMod
  488.     ENDIF
  489.  
  490. ;
  491. ; extern OSStatus RegistryPropertySetMod(const RegEntryID *entry, const RegPropertyName *name, RegPropertyModifiers modifiers)
  492. ;
  493.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  494.         IMPORT_CFM_FUNCTION RegistryPropertySetMod
  495.     ENDIF
  496.  
  497. ; * Iterator operator for entry modifier search
  498.  
  499. ;
  500. ; extern OSStatus RegistryEntryMod(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, RegEntryModifiers matchingModifiers)
  501. ;
  502.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  503.         IMPORT_CFM_FUNCTION RegistryEntryMod
  504.     ENDIF
  505.  
  506. ; * Iterator operator for entries with matching 
  507. ; * property modifiers
  508.  
  509. ;
  510. ; extern OSStatus RegistryEntryPropertyMod(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, RegPropertyModifiers matchingModifiers)
  511. ;
  512.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  513.         IMPORT_CFM_FUNCTION RegistryEntryPropertyMod
  514.     ENDIF
  515.  
  516.  
  517.     ENDIF ; __NAMEREGISTRY__ 
  518.  
  519.